<table border=0 width=100% cellspacing=0 height=350>
    <tr style="height: 18;">
        <TD colspan=4 style="border-bottom: 1px lightgrey solid;">Record Count: <TMPL_VAR name=RECIPIENT_COUNT> of <TMPL_VAR name=TOTAL_COUNT></TD>
        <td colspan=9 style="text-align:right; border-bottom: 1px lightgrey solid;">
            <a href=?active=1>Active</a> (<TMPL_VAR name=ACTIVE_COUNT>)| 
            <a href=?active=0>Inactive</a> (<TMPL_VAR name=INACTIVE_COUNT>)| 
            <a href=?active=0,1>All</a> |
            <a href=addr.cgi?dup>Duplicates</a> |
            <a onClick="RefreshRecipientList();">Refresh</a> |
            <a onClick="get_stats();">Stats</a>
        </td>
    </tr>
    <tr height=10px class=header>
        <th>ID</th>
        <th colspan="2">Salutation</th>
        <th colspan="2">First Name</td>
        <th colspan="2">Last Name</td>
        <th>Company Name</td>
        <th>Company Name Short</td>
        <th>Email Addr</td>
        <th>Active</td>
        <th>Action</th>
        <th style="border-left: 1px solid lightgrey;" width="5%">Result</th>
    </tr>
        <TMPL_LOOP name=RECIPIENTS>
        <tr height=10px>
        <td style="font-size:9px;"><TMPL_VAR name=recipient_id></td>
        <td><TMPL_VAR name=salutations_html></td>
        <td><input type=checkbox id=salutation_include_<TMPL_VAR name=recipient_id> <TMPL_IF name=SALUTATION_INCLUDE>checked</TMPL_IF>></td>
	<td><input class=addrlist name=f_name_<TMPL_VAR name=recipient_id> id=f_name_<TMPL_VAR name=recipient_id> value="<TMPL_VAR name=f_name>"></td>
	<td><input type=checkbox id=f_name_include_<TMPL_VAR name=recipient_id> <TMPL_IF name=F_NAME_INCLUDE>checked</TMPL_IF>></td>

	<td><input class=addrlist name=l_name_<TMPL_VAR name=recipient_id> id=l_name_<TMPL_VAR name=recipient_id> value="<TMPL_VAR name=l_name>">
	<td><input type=checkbox id=l_name_include_<TMPL_VAR name=recipient_id> <TMPL_IF name=L_NAME_INCLUDE>checked</TMPL_IF>></td>

        <td>
            <input class=addrlist name=company_name_<TMPL_VAR name=recipient_id> id=company_name_<TMPL_VAR name=recipient_id> value="<TMPL_VAR name=company_name>"><br>
            <a style="font-size:9px;" onClick="ChangeGroup(<TMPL_VAR name=recipient_id>, <TMPL_VAR name=recipient_group_id>);">change group</a>
        </td>
        <td>
            <input class=addrlist name=company_name_short_<TMPL_VAR name=recipient_id> id=company_name_short_<TMPL_VAR name=recipient_id> value="<TMPL_VAR name=company_name_short>">
            <a style="font-size:9px;" onClick="get_profile(<TMPL_VAR name=recipient_id>);">profile</a>
        </td>
        <td><input class=addrlist name=email_addr_<TMPL_VAR name=recipient_id> id=email_addr_<TMPL_VAR name=recipient_id> value="<TMPL_VAR name=email_addr>"></td>
        <td><input type=checkbox id=active_<TMPL_VAR name=recipient_id> name=active_<TMPL_VAR name=recipient_id> <TMPL_IF name=ISACTIVE>checked</TMPL_IF>></td>
	<td>	<input type=button value='edit' 
		onClick="
		      $('updated_<TMPL_VAR name=recipient_id>').innerHTML = '';
		        EditRecipient(
			['action__edit', 
			'recipient_id__<TMPL_VAR name=recipient_id>', 
			'f_name__' + f_name_<TMPL_VAR name=recipient_id>.value, 
			'f_name_include__' + f_name_include_<TMPL_VAR name=recipient_id>.checked, 
			'l_name__' + l_name_<TMPL_VAR name=recipient_id>.value, 
			'l_name_include__' + l_name_include_<TMPL_VAR name=recipient_id>.checked, 
			'email_addr__' + email_addr_<TMPL_VAR name=recipient_id>.value, 
			'active__' + active_<TMPL_VAR name=recipient_id>.checked, 
			'salutation_id__' + salutation_id_<TMPL_VAR name=recipient_id>.value, 
			'salutation_include__' + salutation_include_<TMPL_VAR name=recipient_id>.checked, 
			'db_type__' + db_type.value,
			'company_name__' + company_name_<TMPL_VAR name=recipient_id>.value,
			'company_name_short__' + company_name_short_<TMPL_VAR name=recipient_id>.value],
			['updated_<TMPL_VAR name=recipient_id>']
			);">
		<input type=hidden name=action id=action value=edit>
		<input type=hidden id=recipient_id_<TMPL_VAR name=recipient_id> value=<TMPL_VAR name=recipient_id>>
		<TMPL_VAR name=edit_ajax>
	</td>
	<td style="border-left: 1px solid lightgrey;padding:0px;"><div id=updated_<TMPL_VAR name=recipient_id> class=smalltext></div>&nbsp;</td>
	</tr>
	</TMPL_LOOP>
	<tr>
	   <TD colspan=5><a target=_ href=./addr/QualityView.pl?group_id=<TMPL_VAR name=group_id>>Quality Correction View</a></TD>
	</tr>
	<tr>
            <TD colspan="5" style="vertical-align:top;" id=pagination_control>
                <a onClick="PaginatorControl('<TMPL_VAR name=paginator_value>');">Turn <TMPL_VAR name=paginator_value> pagination</a>
            </TD>
	<td colspan=8 style="vertical-align:top;border:0px solid grey; text-align:right;">
		<input type=hidden name=db_type id=db_type value=<TMPL_VAR name=db_type>>
		<span style="font-size:8pt; text-align:right;"><TMPL_VAR name=paginator></span>
	</td>
	</tr>
</table>

<script>

function get_stats () {
    var URL = "groups/Stats.pl";
    // alert (URL); 
    Modalbox.show(URL, {title:'Group Statistics',width:'400'});
}

function get_profile (rcpt_id) {
    var URL = "addr/Profile.pl?rcpt_id=" + rcpt_id;
    Modalbox.show(URL, {title:'Recipient Profile',width:'600'});
}
</script>